package com.itheima.set;

import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class Demo02 {

    public static void main(String[] args) {
        Set<String> set= new TreeSet<String>();
        // add  remove  removeif  contains isEmpty  size clear
        set.add("ghi");
        set.add("dere");
        set.add("abc");
        set.add("abc");
        set.add("uio");
        set.add("zhidfgd");
        set.add("xyzddd");

        //迭代器
        Iterator<String> iterator = set.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        System.out.println("=================");
        for (String s : set) {

            System.out.println(s);
        }
        System.out.println("=================");
        set.forEach(s -> System.out.println(s));
    }
}
